Document image orientation assessment and correction

ABSTRACT

The present invention relates to methods and systems for automated processing of document images using mobile and desktop communications devices. Systems and methods are provided for expediting analysis of the accuracy and quality of captured images by such devices before transmission to a server for processing. The processes use on-device software to provide immediate feedback to the user as to whether the quality of the document photograph is sufficient for processing, without the need for intermediate communication with a server. The processes utilize component labeling, MICR character recognition methods, automatic image rotation, and weighted image scaling. The invention increases speed of processing, reduces rates of rejection, increases processor efficiency, limits memory use, identifies images with likely errors, and provides the opportunity for correction of errors at the earliest possible time.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a divisional of application Ser. No. 15/727,051, filed Oct. 6, 2017.

STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT

Not Applicable.

REFERENCE TO SEQUENCE LISTING, A TABLE, OR A COMPUTER PROGRAM LISTING COMPACT DISC APPENDIX

Not Applicable.

BACKGROUND OF THE INVENTION

A number of technologies have been developed to provide businesses and consumers with the ability to transmit or deposit checks and other documents electronically via desktop and mobile devices. These technologies allow users to transmit instruments such as a check by sending an image from a device such as a scanner, cell phone, tablet device, or digital camera in a matter of minutes. Users can take a picture of a document such as a check using the camera in such devices and then transmit the document image for further processing, such as submission for deposit into an account. These technologies can save money for institutions by reducing item processing costs and labor expense, and can provide substantial convenience for businesses and individuals.

The issues that must be addressed by these technologies include capturing an accurate image of the document, effectively and efficiently communicating with the user regarding the adequacy of that image, and verifying the accuracy of the data captured from the image. Recurring problems in these contexts include determining the orientation of the check image, failure to capture an image of the MICR line, and failure to capture images of both sides of the instrument. Other technologies employ various tools to attempt to address this problem. These typically involve taking a photograph of the financial instrument, transmitting the photograph to a distant server, allowing the server software to evaluate the image, and, if the image is found inadequate, communicating the failure back to the user, who must then make appropriate adjustments and try again.

SUMMARY

The present invention involves methods and systems for capturing and processing document images using mobile and desktop devices. Embodiments of the systems and methods described herein facilitate image capture and processing of images by expediting analysis of the accuracy and quality of the image captured. Some systems and methods described herein specifically involve a stationary or mobile communication device that tests and reorients the image it captures before transmission to a server for processing.

Some embodiments of the invention may allow the user to transmit images of the documents using a mobile communication device such as, for example, a mobile telephone with a camera. Other embodiments of the invention may allow the user to transmit images of the documents using a desktop device or other stationary device such as, for example, a scanner and computer.

The present invention uses on-device software to provide immediate feedback to the user as to whether the quality of the document photograph is sufficient for processing. That feedback is provided without the need for intermediate communication with a server. This results in increased speed of processing and reduced rates of rejection of images received for processing from the remote device. The invention also improves the overall experience of the remote deposit capture user by identifying images with likely errors and either automatically correcting them or instructing the user at the earliest possible time to correct them. Use of software for these processes on mobile devices with limited CPU power and memory, however, presents efficiency and capacity challenges. The invention overcomes these challenges by tailoring the processes to limit power and memory demands.

The identification of errors may include immediately determining that what the user has identified as a front image of a check has no MICR characters in the proper section of the image, thus indicating image failure, that the image is upside-down, or that the image is not, in fact, an image of the front of the check. Automatic rotation of the image may be employed to identify and correct an upside-down image. In addition, the invention may show that what the user has identified as a back image of the check has MICR characters, where none should be found, thus indicating likely failure by the user to capture the intended check image, resulting in the capture of a duplicate front check image rather than a back image.

In addition to efficiently locating and recognizing MICR characters and determining proper check image orientation, the systems and methods described herein can be used to properly scale the image of the check. This may be done by calculating the height of the MICR characters, which in turn may be used to calculate the width and height of the original check object from which the image was taken.

DESCRIPTION OF THE DRAWINGS

The present invention is described in detail with reference to the following figures. The drawings are provided for purposes of illustration only and merely to depict example embodiments of the invention. These drawings are for illustrative purposes and are not necessarily drawn to scale.

FIG. 1 is a process flow diagram showing the various processing steps for the analysis of an image of the front of a check.

FIG. 2 is an image of a check identifying the area of a clear band subregion.

FIG. 3 shows initial steps of a component labeling process.

FIG. 4 illustrates the labeling merger process.

FIG. 5 illustrates the use of bounding boxes to measure height and width of labels.

FIG. 6 illustrates the process of comparing labeled pixel locations to character template pixel locations.

FIG. 7 is a process flow diagram showing the various processing steps for the analysis of an image of the back of a check.

DETAILED DESCRIPTION

The purposes of the present invention include the validation and correction of images of financial documents captured on a remote device to ensure that correct and quality images are delivered to a deposit processing service. The invention ensures that, when an image of a financial document is delivered from a remote device: (1) an MICR line is shown on the front check image; (2) the MICR line is on the bottom of the front image and the document is thus upright; (3) there is no MICR line on what the user has identified to be a back check image; and (4) the MICR line is readable and thus the front image is of reasonable (readable) quality. In addition, the invention scales the check image to a reasonably accurate approximation of the actual physical document. As a result, the front and back images of the financial instrument are delivered for processing more efficiently and with a higher likelihood of success.

The present invention provides an efficient mechanism for performing these analyses, as follows. FIG. 1 depicts the overall process encompassed by this invention as applied to the front image of a check.

Image Capture.

A camera device is used to capture an image of the front of the document 102. It may also be used to take a picture of the back of the document. Software within or associated with the device may be used to process the image 103, such as to recognize the corners and/or the edges of the document, to geometrically correct the image to provide a rectangular document image, and to scale to a check sized document; that is, with a range of approximately 1140 to 1880 pixels and at 200 dots per inch (“dpi”), 5.7 to 9.4 inches. In some embodiments, the image may then be converted to black and white.

Image Sectioning.

Also in some embodiments, the image may be sectioned 104, which can increase the speed of image evaluation processing by restricting the area of the check image to be evaluated to a narrow slice of the image. As shown in FIG. 2, because an MICR line is found only along the bottom area of a check in what may be called the “clear band,” only a band, of width=w and height=h, of the bottom of the image (e.g., 25% of height of the image from the bottom edge) 202 may be inspected.

Component Labeling.

Component labeling 106 may then be applied to identify the location of potential characters. The software within or associated with the image capture device may create an initial map of pixel labels for the image band that is [w×h] in size, with each entry initialized with a marker identifying the pixel as unlabeled. The device may then scan the image band, pixel-by-pixel. In one embodiment, this is done consecutively left-to-right, scanning horizontally along each row of pixels in the band, beginning with the top row of pixels, scanning the entire row, moving down to the next row of pixels, scanning the entire row, and continuing the process row by row to the bottom row of pixels, which may be scanned last. Each pixel may be assigned an intensity value, V. For a binary image, V is equal either to 1 or to 0. In a gray level image, V will take on a range of values; for example: V=(51, 52, 53, . . . , 77, 78, 79, 80).

The software associated with the device may apply connected component labeling during the scanning process. In one embodiment, the input is binary and 8-connectivity is used; that is, a second black pixel will be considered connected to a first black pixel if the second black pixel is located to the left or the right of, directly above or below of, or diagonally adjacent to the first black pixel.

Pixel labelling may be used. If the image is binary, the location of each black pixel, for which V={0}, will be assigned a label (L). The location of the first pixel encountered for which V={0} is labeled (e.g., L1). Subsequently, when another pixel location, p_(x,y), is found for which V={0}, the locations of the four neighbors of p_(x,y) that have already been encountered in the scan (e.g., (i) the pixel to the left of p [that is, p_(x−1,y)], (ii) the pixel above it [that is, p_(x,−1)], (iii) the left upper diagonal pixel [that is, p_(x−1,y−1)] and (iv) the upper right diagonal pixel [that is, p_(x+1,y−1)]) are evaluated. The pixel location, p_(x,y), may then be labelled as follows:

-   -   If all four neighbors are V=(1), assign a new label (e.g., L2)         to p_(x,y);     -   if one and only one pixel neighbor has V={0} and thus a label         (e.g., L1), assign that label to p_(x,y); else     -   if more than one of the neighbors have V={0} and thus have been         assigned a label (e.g., L1 and L2), assign one of the labels to         p_(x,y) and merge the labels (e.g., all pixel locations with L2         assigned L1 (i.e., L2=>L1)).

FIG. 3 presents the results of the initial row scans of a simplified example of the binary, 8-connectivity component labeling process for a 10 pixel wide segment of the subregion band of the document image. In this example, the scan of the first row of pixels finds no black pixels (i.e. V={1}), thus V_(1,1) through V_(10,1) are all ones. Correspondingly, none of these pixel locations are assigned a label in the first row of the image's label map, L_(x,y), so that each location remains unlabeled (U).

Further in this example, the scan of the second row of pixel locations finds black pixels (V={0}) at p_(2,2), p_(5,2), and p_(8,2). The processor also determines that none of these locations has a black pixel as its neighbor pixel location above, to the left, or diagonally above. Thus, as shown in FIG. 3, the process assigns each of these pixel locations a different label in the second row of the label map; that is, for example, labels L1, L2, and L3, respectively.

The scan of the third row of pixel locations in the subregion of the document image finds black pixels (V={0})) at p_(3,3), p_(5,3), and p_(10,2). The processor then determines that the pixel location p_(3,3), has a diagonal left neighbor that already has been assigned a label L in the second row of the corresponding label map, L_(x,y). It therefore assigns the same label (L1) to pixel position p_(3,3). The processor also finds a black pixel at p_(5,3). Because the pixel p_(5,2) location directly above that pixel already has received label L2 in the label map, pixel location p_(5,3) is assigned the same label (L2). The scan next finds a black pixel at p_(10,3). There is no connected black pixel at this location, so position p_(10,3) in the label map is assigned a new label, L4.

FIG. 4 continues the above example, showing merger of labels when a pixel location is found to have multi-connectivity to already labelled pixel locations. In the example, the scan of the fourth row of pixel locations finds a black pixel (V={0}) at p_(4,4). The pixel location to its diagonally above, left position (that is, p_(3,3)) has already been assigned L1 in the corresponding label map, L_(x,y). Also, as shown in FIG. 3, the pixel location to its diagonally above, right position (that is, p_(5,3)) was already assigned a different label, L2. Because pixel p_(4,4) is connected to pixels with two different labels, the two labels, that is, labels L and L2, are “merged” into label L1, and pixel location p_(4,4) takes on that same label, L1, as shown in FIG. 4. Thus, pixel locations p_(3,3), p_(3,5), and p_(4,4), because they are 8-connected, are given the same label; in this case, L1.

The continued scan of the fourth row finds a black pixel at p_(8,4). This is not connected to any black pixel location that so far has been identified, so it is assigned a new label, L5, in the label map. The last pixel in the fourth row, p_(4,10), of this example is also found to be black, but it is connected to the black pixel location p_(3,10), directly above it, so it takes on the label of p_(3,10); that is, L4.

The process continues until all rows have been scanned and labels assigned. The labeling and merging process may occur during a single scan that incorporates the merger process, as in the above example, or all pixel locations may be labeled during an initial scan with the merging process occurring during a second scan of the individually labelled pixels.

The process results in label arrays (La, Lb, . . . L_(i)), with each label containing a collection of addresses of pixel locations, p_(x,y), that are mapped to that particular label; that is, p^(map) [x,y]=L_(i). Each label array thus identifies the locations of those pixels that are connected, representing the location of a connected series of black pixels. For example, for the labeled pixel locations shown in FIG. 4, an array of L1 labels has been created with coordinates {(2,2), (2,5), (3,3), (3,5), (4,5)}. The pixel mapping allows the labelling process to be fast, as the analysis of each pixel for connectivity need only consider four adjacent pixel locations.

Label Pruning.

The number of labels may be pruned for efficiency to eliminate label arrays that most likely do not represent characters of interest 108. Each label array has a “bounding box” defined as a rectangle determined by the coordinates of the label's outer most pixel locations. By way of simple example, as shown in FIG. 5, if label array L5 consists of pixel locations with coordinates {128, 92}, {129, 92}, {130, 92}, {128, 93}, {129, 93}, {130, 93}, {128, 94}, {130, 94}, its bounding box would be determined by the horizontal and vertical lines passing through coordinates {128, 92} and {130, 94}. In practice, to improve speed and efficiency of process, label arrays whose bounding box is too large (e.g., >38 pixel height or width) or too small (e.g., <20 pixel height or <10 pixel width) to possibly identify an MICR numeric character (0 thru 9) may be discarded. This eliminates connected pixel objects that are not likely to constitute MICR characters.

Label Testing.

Label arrays remaining after pruning (if pruning is used) represent candidate MICR characters and may be tested to determine whether they designate a character of interest 110. The bounding boxes for these candidate character labels may be extended with white pixels to result in a label box of size n×n pixels. For example, a label array measured at 18 pixel width×32 pixel height may be normalized with the candidate character left-justified and white pixels added to the right as “fill” to form a 32×32 pixel map.

Each label may then be compared to character templates. For example, the comparison may be to a reference set of the United States standard E13B font for the MICR characters 0 through 9, each of which characters are full height with all black pixels contiguous. The MICR templates often are normalized as square m×m bitmaps (for example, 96×96). The comparison is done pixel by pixel using simple linear mathematics to transpose the location of each pixel in the n×n label array and compare it to the comparably located pixel in the m×m character template array. Thus, for example, if the MICR template consists of 96×96 pixels and the label box is normalized to an array of 32×32 pixels, the value of each label assigned to pixel location p_(x,y) may be compared to the value of the template pixel t_(3x,3y).

FIG. 6 presents a simplified example of the label testing process for a hypothetical array of pixel locations with label L6 tested against a binary character template for the number zero. In this example, the normalized label array is only four by four, and the template character array, showing luminosity values V={0} (i.e., black) or V={1} (i.e., white), is only twelve by twelve. Comparing the location of each p_(x,y) bearing an L6 label to the corresponding luminosity value of the pixel at the corresponding character pixel location, t_(3x,3y), it is apparent that there is a “match” of a labeled pixel location to a character pixel location with black luminosity (with V={0}) at p_(1,1), p_(1,2), p_(1,3), p_(1,4), p_(2,1), p_(2,4), p_(3,1), p_(3,4), p_(4,1), p_(4,2), and p_(4,3); that is, corresponding to character pixel locations t_(3,3), t_(3,6), t_(3,9), t_(3,12), t_(6,3), t_(6,12), t_(9,3), t_(9,12), t_(12,3), t_(12,6), and t_(12,9). The only labeled pixel position without a match to a black pixel location in the character template is p_(1,4). The comparison process can result in a matching score, representing the number of pixel locations in a label array that match the corresponding character template pixel. In the above example, there were matches for 11 out of the 12 labeled pixel locations, resulting in a score of 92%. The more typical label array would be 32×32. In practice, the test may be run for each label array relative to each of the ten character templates for the numeric characters zero through nine. Candidate characters with a matching score below a first threshold (e.g., 85%) for a label array may be discarded as candidate characters for that label. If a label array has a matching score above the first threshold for more than one candidate character array, the candidate character with the highest matching score for the label array may be accepted as the character designated by that particular label array.

MICR Line Presence.

The total number of label arrays with a matching score above the threshold for a candidate character (“Accepted Labels”) may then be determined 112. An MICR line may be deemed to be present in the image if there is a number of Accepted Labels, and thus MICR characters, equal to or greater than a second threshold (e.g., >=5) 113. The image may then be transmitted for processing 114. If it is found that there are not a number of Accepted Labels whose score is equal to or exceeds the second threshold 115, the MICR line may be deemed not to be present in the subregion of the document image as oriented.

Upside-Down Testing.

If the MICR line is deemed not to be present 115, the device may determine whether it has rotated the image 116 and, if not 117, rotate the image 180 degrees 118. The above described procedure may be carried out again, as shown in FIG. 1, to determine if the image was upside down when analyzed. If the number of Accepted Labels equals or then exceeds the second threshold 113, the image with the 180 degree rotation is accepted as the front image of the financial document and may be transmitted for processing 114. If the number of Accepted Labels does not exceed the second threshold 115 and the image already has been rotated 119, the image may be rejected 120.

Back Image Validation.

If the document is a check, the image that the user has designated as the image of the back of the check may then also be evaluated using the above procedure. FIG. 7 summarizes this process. If the labels so generated equal or exceed the accepted label threshold determination 714 and thus indicate the presence of an MICR line, it may be concluded that, because an MICR line appears where no MICR line should appear (that is, on the back of a check), the user likely has failed to flip the check to take a proper image of its back and the second image may be rejected 716. Conversely, if no MICR line is detected 715, the document may be deemed a proper check back and transmitted for processing 720. Alternatively, the processor may consider whether the check has been reanalyzed after rotation 718, and if it has not 717, the check may be rotated and reanalyzed. If it is similarly determined that the accepted label threshold has not been reached 715 after rotation 718, thus indicating no MICR line present, then the image may be determined to be a proper back check image and be transmitted for processing 720.

Image Scaling.

Proper sizing of captured check images results in improved performance of check processing software, and sizing and character density criteria, such as ANSI X9.100-160-1-2015, may need to be satisfied. For example, applicable standards may require that images of checks be 200 dpi and between 1140 and 1880 pixels, corresponding to checks of 5.7 to 9.4 inches in width.

Image scaling for documents for which an MICR line is found may thus be carried out. This may be accomplished by first calculating a weighted average height (H^(w)) of the heights of the Accepted Labels (H_(i)). The weighting is based upon the relative matching scores of the Accepted Labels (L_(i)). For example:

If L₁, with height H₁, has a matching score of >0.975, then its weighting factor=7H₁

If L2, with height H₂, has a matching score of >0.95 but ≤0.975, then its weighting factor=3H₂

If L3, with height H₃, has a matching score of >0.925 but ≤0.95, then its weighting factor=2H₃

If L4, with height H₄, has a matching score of >0.9 but ≤0.925, then its weighting factor=1H₄

The weighted average height, H^(w), is then calculated. For example, if there are a total of 10 characters with Accepted Labels found, and 4 are of H₁ and 6 are of H₂, then: H ^(w)=[(6*7H ₁)+(4*3H ₂)/54

A known MICR height of ⅛ inch (e.g., 25 pixels at 200 dpi) may be used to determine the approximate actual width (W^(m)) of the check; that is: since (25/W ^(m))=(H ^(w) /w), where w is the width of the source image, then W=(25*w)/H ^(w).

W^(m) must be within established parameters (e.g., standard check sizes of 1140 to 1880 pixels), or the value may be discarded and the check not scaled. 

The invention claimed is:
 1. A method for determining a proper orientation of a static image of a document consisting of a plurality of pixels within a viewfinder of an image capturing device controlled by a processor, comprising: a. acquiring on the device the static image of the document consisting of a plurality of pixels; b. locating a specified subregion of the image; c. selecting a specified set of known characters of a defined font, each said known character comprising a single set of contiguous character defining pixels of known relative location and known luminosity or luminosity range; d. determining a luminosity or luminosity range of a plurality of pixels within the subregion; e. creating a matrix of the locations of pixels that are within said subregion; f. selecting a first specified luminosity or luminosity range; g. identifying the locations of pixels within said subregion that are of said first specified luminosity; h. assigning in said matrix a unique label to each location of a pixel with said first specified luminosity; i. merging the labels assigned to pixel locations to a common distinctive label group if said pixel locations in said matrix are 8-connected; j. selecting a second specified luminosity or luminosity range, wherein said second specified luminosity or luminosity range may be the same as or different from said first specified luminosity or luminosity range; k. for each pixel location within each said distinctive label group, determining the luminosity or luminosity range of the character defining pixel at the similar relative pixel location within each set of character defining pixels; l. for each pixel location within each said distinctive label group and for each set of character defining pixels, determining whether each said pixel location matches the similar relative pixel location of a character defining pixel of the second specified luminosity or luminosity range within each set of character defining pixels; m. determining a number of said matches for each distinctive label group and each known character; n. identifying each distinctive label group with said matches in excess of a second threshold number as a known character; o. calculating a number of known characters in the subregion; p. determining proper orientation of the static image of the document if the number of known characters in the subregion exceeds a first threshold number; and q. concluding that the orientation of the static image of the document has not been determined if the number of known characters in the subregion does not exceed the first threshold number.
 2. The method of claim 1, wherein said determining whether a pixel location within a distinctive label group matches the similar relative pixel location of a character defining pixel of the second specified luminosity or luminosity range within each set of character defining pixels comprises: a. adjusting at least one of a height and a width of the pixel's distinctive label group matrix to match an aspect ratio of a matrix of each set of character defining pixels; b. for each set of character defining pixels, comparing a relative coordinate location of the pixel within the adjusted distinctive label group matrix to a corresponding relative coordinate location of a pixel within the set of character defining pixels; c. determining whether the pixel at the corresponding relative coordinate location within the set of character defining pixels is a pixel of said second specified luminosity or luminosity range; and d. concluding that there is a match between the pixel location within the distinctive label group and the corresponding location of the character defining pixel if said character defining pixel is of said second specified luminosity or luminosity range.
 3. The method of claim 1, wherein identifying each distinctive label group with said matches in excess of a second threshold number as a known character further comprises assigning to the distinctive label group the known character with a highest number of said matches.
 4. The method of claim 1, wherein distinctive label groups are eliminated from consideration as a known character on a basis of one or more size criteria.
 5. The method of claim 4, wherein said eliminating a distinctive label group for consideration as a known character based upon one or more size criteria comprises: a. determining a label height for the distinctive label group by determining a maximum vertical distance between any two pixel locations assigned the unique label of said distinctive label group; and b. discarding the distinctive label group if said label height is in excess of a first limit number or less than a second limit number.
 6. The method of claim 4, wherein said eliminating a distinctive label group for consideration as a known character based upon one or more size criteria comprises: a. determining a label width for the distinctive label group by determining a maximum horizontal distance between any two pixel locations assigned the unique label of said distinctive label group; and b. discarding the distinctive label group if said label width is in excess of a third limit number or less than a fourth limit number. 